package top.toptimus.dto.qcDto;

import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.util.ResourcesUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 款式历史记录
 *
 * @author gaoyu
 */
@NoArgsConstructor
@Data
public class StyleDesignHistoryEntity implements Cloneable {

    private Long styleDesignId;
    //小样区分
    private String sampleFlag = "";
    //数量
    private BigDecimal quantity;

    //-------s-------日本大货专用------------------//

    // 价格
    private String price;
    // 实际交付日期
    private Date realDate;

    //-------e-------日本大货专用-----------------//


    private String barInfo = "";


    //-------s-------小程序订单专用------------------//

    //店铺id
    private String shopId;

    // 交易号
    private String businessNo;

    // 交易号条码
    private String businessBarCode;

    // 交易号订单数
    private String accountingOrderSize;

    // 收件人姓名
    private String addresseeName;

    // 收件人电话
    private String addresseeTel;

    // 收货地址-省
    private String addressProvinceCd;

    // 收货地址-市
    private String addressCityCd;

    // 收货地址-区
    private String addressDistrict;

    // 收货地址-详情
    private String addressDetail;

    // 收货邮政编码
    private String zipCode;

    //-------e-------小程序订单专用-----------------//

    //订单号
    private String orderNo = "";
    //订单状态
    private String orderStatusFlag = "";
    //订单日期
    private Date orderDate;
    //客户名称（顾客）
    private String customerName = "";
    //店名
    private String shopName = "";
    //客户订单号(平台交易号)
    private String customOrderNo = "";
    //客户
    private String customName = "";
    //制作方法
    private String customMakeShirt = "";
    //Transit Group
    private String transitGroup = "";
    //国家
    private String country = "";
    //船期
    private Date shipmentDate;
    //交期重要
    private String urgentOrder = "";
    //量体样衣
    private String tryonOrder = "";
    //特殊订单
    private String specialOrder = "";
    //发货目的地
    private String shippingDestination = "";
    //款式中文名（新版）
    private String styleNameCn = "";
    //袖子区分
    private int sleeveFlag;
    //自带面料区分
    private int materialSource;
    //款式类别
    private String orderParts = "";
    //面料品号
    private String fabricCode = "";
    //面料成分
    private String fabricComposition = "";
    //幅宽
    private String fabricWidth = "";
    //衬衫规格
    private String shirtSize = "";
    //尺码组code
    private String sizeGroup = "";
    //尺码code
    private String sizeCd = "";
    //原辅料费用
    private String materialCost = "";
    //平台量尺itemValue字符集
    private String itemValueMTM = "";
    //量尺加值
    private String inValue = "";
    //量尺减值
    private String outValue = "";
    //设计费用code集
    private String designCostCode = "";
    //设计费用value集
    private String designCostValue = "";
    //设计费用cost集
    private String designCostCost = "";
    //
    /*衬衫款式*/
    private String modelSma = "";

    private String modelShm = "";

    private String modelSsl = "";

    private String modelSco = "";

    private String modelScu = "";

    private String modelSsv = "";

    private String modelSsk = "";

    private String modelSbo = "";

    private String modelSfp = "";

    private String modelSbp = "";

    private String modelSba = "";

    private String modelSst = "";

    private String modelSpo = "";

    private String modelSbd = "";

    private String modelSbj = "";

    private String modelSbs = "";

    private String modelWash = "";

    private String modelSpck = "";

    private String modelRibb = "";

    private String modelStitch = "";
    //
    /*辅料*/
    private String trimThdno = "";

    private String trimSgd = "";

    private String trimSbu = "";

    private String trimSbh = "";

    private String trimSat = "";

    private String trimSbt = "";

    private String trimSts = "";

    private String trimSbi = "";
    //
    /*衬衫规格（量尺）*/
    private String size12che = "";

    private String size12wai = "";

    private String size12hip = "";

    private String sizeYok = "";

    private String sizeYunLen = "";

    private String sizeLen = "";

    private String sizeCol = "";

    private String sizeUam = "";

    private String sizeFal = "";

    private String sizeFar = "";

    private String sizeScl = "";

    private String sizeScr = "";

    private String sizeCll = "";

    private String sizeClr = "";

    private String sizeSsl = "";

    private String sizeSsr = "";

    private String sizeSll = "";

    private String sizeSlr = "";

    private String sizeLsl = "";

    private String sizeLsr = "";

    private String sizeRbh = "";

    private String sizeBof = "";
    //
    /*标牌*/
    private String lablSize = "";
    //小号种类
    private String lablSizeType = "";

    private String lablLp1 = "";

    private String lablLp2 = "";

    private String lablLp3 = "";

    private String lablLp4 = "";

    private String lablLp5 = "";

    private String lablLp6 = "";

    private String lablHas = "";

    private String lablCl = "";

    private String lablClt = "";

    private String lablCoo = "";

    private String lablFabric = "";
    //
    /*配料*/
    private String contSc1 = "";

    private String contSc2 = "";

    private String contSc3 = "";

    private String contSc4 = "";

    private String contSc5 = "";

    private String contSc6 = "";

    private String contSc7 = "";

    private String contSc8 = "";

    private String contSc9 = "";

    private String contSc0 = "";

    // JPress 配料
    private String contJpA = "";
    private String contJpHSB = "";
    private String contJpHSC = "";
    private String contJpHSD = "";
    private String contJpHSE = "";
    private String contJpHSF = "";
    private String contJpHSG = "";
    private String contJpH1 = "";
    private String contJpI = "";
    private String contJpJ = "";
    private String contJpB = "";
    private String contJpD = "";
    private String contJpE = "";
    //
    /*刺绣*/
    private String embrText = "";

    private String embrSmc = "";

    private String embrSmo = "";

    private String embrSmp = "";

    private String embrSms = "";

    //
    private Long enableFlag;

    private Long deleteFlag;

    private Long version;

    private Date createDate;

    private Date updateDate;

    private Long createUser;

    private Long updateUser;

    private String remarks;


    @Override
    public StyleDesignHistoryEntity clone() {
        StyleDesignHistoryEntity stu = null;
        try {
            stu = (StyleDesignHistoryEntity) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return stu;
    }

    public StyleDesignHistoryEntity(
            String orderNo
            , String SytleFabricNo
            , String StyleNameCn
            , StyleFitEntity styleFitEntity
            , List<StyleOptionREntity> styleOptionList
    ) {
        // map集合
        Map<String, String> tempMap = new HashMap<String, String>();
        // 遍历放入map集合中
        for (StyleOptionREntity sEntity : styleOptionList) {
            // 若为扣，则设置扣数
            if (ResourcesUtil.getConfig("shirt_sbu").equals(sEntity.getItemValue())) {
                tempMap.put(sEntity.getItemValue(), String.valueOf(sEntity.getOptionCost().intValue()));
            } else {
                tempMap.put(sEntity.getItemValue(), sEntity.getOptionValue());
            }
        }
        // 设置数据载体
        this.setOptionData(SytleFabricNo, StyleNameCn, tempMap, styleFitEntity);
        // 设置订单号
        this.setOrderNo(orderNo);
    }

    /**
     * 设置数据载体
     */
    private void setOptionData(String SytleFabricNo, String StyleNameCn, Map<String, String> optionMap, StyleFitEntity styleFitEntity) {
        // 物料号
        this.setFabricCode(SytleFabricNo);
        // 缝制方式
        this.setModelSma(optionMap.get(ResourcesUtil.getConfig("shirt_4sma")));
        // 款式中文名
        this.setStyleNameCn(StyleNameCn);
        // 缝制线
        this.setTrimThdno(optionMap.get(ResourcesUtil.getConfig("shirt_thread")));
        // 线号
        this.setTrimSgd(optionMap.get(ResourcesUtil.getConfig("shirt_sgd")));
        // 扣数
        this.setTrimSbu(optionMap.get(ResourcesUtil.getConfig("shirt_sbu")));
        // 袖子
        this.setModelSsl(optionMap.get(ResourcesUtil.getConfig("shirt_ssl")));
        // 领子
        this.setModelSco(optionMap.get(ResourcesUtil.getConfig("shirt_sco")));
        // 袖头
        this.setModelScu(optionMap.get(ResourcesUtil.getConfig("shirt_scu")));
        // 订扣
        this.setTrimSat(optionMap.get(ResourcesUtil.getConfig("shirt_sat")));
        // 袖开祺
        this.setModelSsv(optionMap.get(ResourcesUtil.getConfig("shirt_ssv")));
        // 订扣线颜色
        this.setTrimSbh(optionMap.get(ResourcesUtil.getConfig("shirt_sbh_colour")));
        this.setTrimSbt(optionMap.get(ResourcesUtil.getConfig("shirt_sbt_colour")));
        // 衬布 (新版没有衬布钱)
        this.setModelSsk(optionMap.get(ResourcesUtil.getConfig("shirt_ssk")));
        // 领子，袖头配色线
        this.setTrimSts(optionMap.get(ResourcesUtil.getConfig("shirt_sts_colour")));
        // 领插签
        this.setModelSbo(optionMap.get(ResourcesUtil.getConfig("shirt_sbo")));
        // 台领下夹牙绳
        this.setTrimSbi(optionMap.get(ResourcesUtil.getConfig("shirt_sbi")));
        // 前立
        this.setModelSfp(optionMap.get(ResourcesUtil.getConfig("shirt_sfp")));
        // 胸兜
        this.setModelSbp(optionMap.get(ResourcesUtil.getConfig("shirt_sbp")));
        // 后背款式
        this.setModelSba(optionMap.get(ResourcesUtil.getConfig("shirt_sba")));
        // 水洗要求
        this.setModelWash(optionMap.get(ResourcesUtil.getConfig("shirt_washed")));
        // 领子，袖口明线
        this.setModelSst(optionMap.get(ResourcesUtil.getConfig("shirt_sst")));
        // 包装方法
        this.setModelSpck(optionMap.get(ResourcesUtil.getConfig("shirt_packaging")));
        // 手绢
        this.setModelSpo(optionMap.get(ResourcesUtil.getConfig("shirt_spo")));
        // Ribbon
        this.setModelRibb(optionMap.get(ResourcesUtil.getConfig("shirt_ribbon")));
        // 后省
        this.setModelSbd(optionMap.get(ResourcesUtil.getConfig("shirt_sbd")));
        // 过肩
        this.setModelSbj(optionMap.get(ResourcesUtil.getConfig("shirt_sbj")));
        // 底摆款式
        this.setModelSbs(optionMap.get(ResourcesUtil.getConfig("shirt_sbs")));
        // 小号
        this.setLablSize(optionMap.get(ResourcesUtil.getConfig("shirt_sizelabel")));
        // 台领里配料
        this.setContSc1(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc1")));
        // 后领中订商标
        this.setLablLp1(optionMap.get(ResourcesUtil.getConfig("shirt_slc_lp01")));
        // 羽领，台领配料
        this.setContSc2(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc2")));
        // 三角布
        this.setLablLp2(optionMap.get(ResourcesUtil.getConfig("shirt_slc_lp02")));
        // 袖头里配料
        this.setContSc3(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc3")));
        // 上前立里侧订商标
        this.setLablLp3(optionMap.get(ResourcesUtil.getConfig("shirt_slc_lp03")));
        // 袖头配料
        this.setContSc4(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc4")));
        // 下前立里侧订商标
        this.setLablLp4(optionMap.get(ResourcesUtil.getConfig("shirt_slc_lp04")));
        // 台领配料
        this.setContSc5(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc5")));
        // 大布订商标
        this.setLablLp5(optionMap.get(ResourcesUtil.getConfig("shirt_slc_lp05")));
        // 上前立表配料
        this.setContSc6(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc6")));
        // 后领缝商标
        this.setLablLp6(optionMap.get(ResourcesUtil.getConfig("shirt_slc_lp06")));
        // 下前立配料
        this.setContSc7(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc7")));
        // 吊牌
        this.setLablHas(optionMap.get(ResourcesUtil.getConfig("shirt_hangtag")));
        // 袖补强布配料
        this.setContSc8(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc8")));
        // 洗涤成分
        this.setLablCl(optionMap.get(ResourcesUtil.getConfig("shirt_carelabel")));
        // 手绢配料
        this.setContSc9(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc9")));
        // Care label type
        this.setLablClt(optionMap.get(ResourcesUtil.getConfig("shirt_labeltype")));
        // 大布配料
        this.setContSc0(optionMap.get(ResourcesUtil.getConfig("shirt_contrast_sc0")));
        // 产地标
        this.setLablCoo(optionMap.get(ResourcesUtil.getConfig("shirt_country")));
        // 刺绣内容
        this.setEmbrText(optionMap.get(ResourcesUtil.getConfig("4smt")));
        // 量体数据
        String[] itemValueList = styleFitEntity.getItemValue().split(",");
        String[] fitValueList = styleFitEntity.getFitValue().split(",");
        for (int i = 0; i < itemValueList.length; i++) {
            //左袖头围左
            if ("CIRCU_ITEM_17".equals(itemValueList[i])) {
                this.setSizeCll(fitValueList[i]);
                //右袖头围右
            } else if ("CIRCU_ITEM_18".equals(itemValueList[i])) {
                this.setSizeClr(fitValueList[i]);
                //左袖长
            } else if ("POSTU_ITEM_07".equals(itemValueList[i])) {
                this.setSizeSll(fitValueList[i]);
                //右袖长
            } else if ("POSTU_ITEM_09".equals(itemValueList[i])) {
                this.setSizeSlr(fitValueList[i]);
                //左肩高
            } else if ("CIRCU_ITEM_19".equals(itemValueList[i])) {
                this.setSizeLsl(fitValueList[i]);
                //右肩高
            } else if ("CIRCU_ITEM_21".equals(itemValueList[i])) {
                this.setSizeLsr(fitValueList[i]);
            }
        }
    }
}